package com.shaw.tiger;

public class InterpreterPatternDemo {

	public static void main(String[] args) {
		Expression isMale = getMaleExpression();
		Expression isMarried = getMarriedWomanExpression();
		
		System.out.println("Shaw is male"+isMale.interpret("shaw"));
		System.out.println("Spring is a married women?"+isMarried.interpret("Married spring"));
	}

	public static Expression getMaleExpression() {
		Expression shaw = new TerminalExpression("shaw");
		Expression tiger = new TerminalExpression("tiger");
		return new OrExpression(shaw, tiger);
	}

	public static Expression getMarriedWomanExpression() {
		Expression spring = new TerminalExpression("spring");
		Expression married = new TerminalExpression("Married");
		return new AndExpression(spring, married);
	}
	

}
